numpy empty array

32

import numpy as np

n = 2
X = np.empty(shape=[0, n])

for i in range(5):
    for j  in range(2):
        X = np.append(X, [[i, j]], axis=0)

print X
    a = []
    for x in y:
        a.append(x)
    a = np.array(a)
# Create an empty array with 2 elements
np.empty(2)
array([ 3.14, 42.  ])  # may vary

Comments

Submit
0 Comments